1 /* 2 * Copyright (C) 2010 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS-IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.common.collect; 18 19 import com.google.common.annotations.Beta; 20 import com.google.common.annotations.GwtCompatible; 21 import com.google.common.base.Function; 22 23 import java.util.concurrent.ConcurrentMap; 24 import java.util.concurrent.TimeUnit; 25 26 /** 27 * A class exactly like {@link MapMaker}, except restricted in the types of maps it can build. 28 * For the most part, you should probably just ignore the existence of this class. 29 * 30 * @param <K0> the base type for all key types of maps built by this map maker 31 * @param <V0> the base type for all value types of maps built by this map maker 32 * @author Kevin Bourrillion 33 * @since 7.0 34 * @deprecated This class existed only to support the generic paramterization necessary for the 35 * caching functionality in {@code MapMaker}. That functionality has been moved to {@link 36 * com.google.common.cache.CacheBuilder}, which is a properly generified class and thus needs no 37 * "Generic" equivalent; simple use {@code CacheBuilder} naturally. For general migration 38 * instructions, see the <a 39 * href="http://code.google.com/p/guava-libraries/wiki/MapMakerMigration">MapMaker Migration 40 * Guide</a>. 41 */ 42 @Beta 43 @Deprecated 44 @GwtCompatible(emulated = true) 45 abstract class GenericMapMaker<K0, V0> { 46 47 // Set by MapMaker, but sits in this class to preserve the type relationship 48 49 // No subclasses but our own 50 GenericMapMaker() {} 51 52 /** 53 * See {@link MapMaker#initialCapacity}. 54 */ 55 public abstract GenericMapMaker<K0, V0> initialCapacity(int initialCapacity); 56 57 /** 58 * See {@link MapMaker#maximumSize}. 59 */ 60 abstract GenericMapMaker<K0, V0> maximumSize(int maximumSize); 61 62 /** 63 * See {@link MapMaker#concurrencyLevel}. 64 */ 65 public abstract GenericMapMaker<K0, V0> concurrencyLevel(int concurrencyLevel); 66 67 /** 68 * See {@link MapMaker#expireAfterWrite}. 69 */ 70 abstract GenericMapMaker<K0, V0> expireAfterWrite(long duration, TimeUnit unit); 71 72 /* 73 * Note that MapMaker's removalListener() is not here, because once you're interacting with a 74 * GenericMapMaker you've already called that, and shouldn't be calling it again. 75 */ 76 77 /** 78 * See {@link MapMaker#makeMap}. 79 */ 80 public abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeMap(); 81 82 /** 83 * See {@link MapMaker#makeComputingMap}. 84 */ 85 @Deprecated 86 abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeComputingMap( 87 Function<? super K, ? extends V> computingFunction); 88 }